"""d"""

"""
1,os.path.dirname(path)
    获取当前文件路径，去掉文件名目录结构,取到上一层的目录
    
2，os.path.dirname(__file__)
    当前文件的路径
    
3,os.path.absname()
    函数返回的是包含文件的绝对路径
    
4,os.path.join()
    连接两个或更多的路径名组件
    
"""
import os
# print(os.path.dirname(r'D:\daima\xin-daima\kejian\os详解\test777.py'))
#
# print(os.path.dirname(r'D:\daima\xin-daima\kejian\os详解'))
#
#
# print(__file__)
#
# print(os.path.dirname(__file__))
# print(os.path.dirname(r'D:\daima\xin-daima\kejian\os详解\test777.py'))

# #获取当前文件的路径
# print(os.path.abspath(__file__))
#
# #获取当前文件的上一层目录
# print(os.path.dirname(os.path.abspath(__file__)))
#
# #获取当前文件的上上层目录
# print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

# path1 = 'home'
# path2 = 'develop'
# path3 = 'code'
#
# path10 = path1 + path2 + path3
# path20 = os.path.join(path1,path2,path3)
#
# print(path10)
# print(path20)

"""
1，如果各组件名首字母不包含'/'，则函数会自动加上
homedevelopcode
home\develop\code"""

# path1 = '/home'
# path2 = 'develop'
# path3 = 'code'
#
# path10 = path1 + path2 + path3
# path20 = os.path.join(path1,path2,path3)
#
# print(path10)
# print(path20)

# path1 = 'home'
# path2 = '/develop'
# path3 = 'code'
#
# path10 = path1 + path2 + path3
# path20 = os.path.join(path1,path2,path3)
#
# print(path10)
# print(path20)
"""
2，如果有一个组件是一个绝对路径，则 在它之前的所有组件均会被舍弃
home/developcode
/develop\code
"""

# path1 = 'home'
# path2 = 'develop'
# path3 = '/code'
#
# path10 = path1 + path2 + path3
# path20 = os.path.join(path1,path2,path3)
#
# print(path10)
# print(path20)